using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace WebDauGia.Domain.Models.Mapping
{
    public class HinhAnhMap : EntityTypeConfiguration<HinhAnh>
    {
        public HinhAnhMap()
        {
            // Primary Key
            this.HasKey(t => t.id);

            // Properties
            // Table & Column Mappings
            this.ToTable("HinhAnh");
            this.Property(t => t.id).HasColumnName("id");
            this.Property(t => t.link_hinhnho).HasColumnName("link_hinhnho");
            this.Property(t => t.link_hinhlon).HasColumnName("link_hinhlon");
            this.Property(t => t.idsanpham).HasColumnName("idsanpham");

            // Relationships
            this.HasOptional(t => t.SanPham)
                .WithMany(t => t.HinhAnhs)
                .HasForeignKey(d => d.idsanpham);
            this.HasOptional(t => t.SanPham1)
                .WithMany(t => t.HinhAnhs1)
                .HasForeignKey(d => d.idsanpham);

        }
    }
}
